<?php
namespace app\modules\frontend\controllers;

use Yii;
use app\models\Product;

use yii\web\Controller;
use app\models\ProductSale;
use yii\data\ActiveDataProvider;


class SaleController extends Controller{

    public function actionIndex($id){

        $this->layout='product';
        //在产品销售表中查找属于该产品的销售信息
        $sql="select * from shbb_product_sale where product_id=$id";

        $models=ProductSale::findBySql($sql)->all();

        return $this->render('index',['models'=> $models]); //将数据源传给index视图


    }
}